package pack0924;

import java.util.Arrays;

public class DemoD {

    public static void main(String[] args) {
        int[] arr = new int[50];
        for (int i = 0; i < arr.length; i++) {
            arr[i] = (int) (Math.random() * 100 + 1);
        }
        System.out.println(Arrays.toString(arr));
        // 找出最大值
        int max = Arrays.stream(arr).max().getAsInt();
        // 找出最小值
        int min = Arrays.stream(arr).min().getAsInt();
        // 求和
        int sum = Arrays.stream(arr).sum();
        // 找出这个数
        int index = Arrays.binarySearch(arr, 17);
        System.out.println(max);
        System.out.println(min);
        System.out.println(sum);
        System.out.println(index);
    }
}